from ronglian_sms_sdk import SmsSDK

accId = '8a216da87a332d53017ae5e165ed34bf'
accToken = 'd1d2ed155f904f3ea892b830ed91b8f6'
appId = '8a216da87a332d53017ae5e166e234c6'
import json


def send_message(mobile, code, time):
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'
    mobile = mobile
    datas = (code, time)
    resp = sdk.sendMessage(tid, mobile, datas)
    result = json.loads(resp)
    if result['statusCode'] == '000000':
        return True
    return False


# redis 存储数据
def get_redis_conn():
    from django_redis import get_redis_connection
    conn = get_redis_connection()
    return conn
